gtk: Port all users to the new gtk_show_uri()
authorMatthias Clasen <mclasen@redhat.com>
Sun, 12 Apr 2020 01:58:19 +0000 (21:58 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 12 Apr 2020 02:10:08 +0000 (22:10 -0400)
We were only handling the error in one place anyway.

gtk/gtkaboutdialog.c
gtk/gtkfilechooserwidget.c
gtk/gtklabel.c
gtk/gtklinkbutton.c
gtk/gtkprintoperation-portal.c
gtk/gtkprintoperation-unix.c

index 577eb6e6333faf96e6c7e6ff0c15a0dce930b23c..1c3363169699020c434891d3070b2bd87e95af8f 100644 (file)
@@ -77,7 +77,7 @@
  * All parts of the dialog are optional.
  *
  * About dialogs often contain links and email addresses. GtkAboutDialog
- * displays these as clickable links. By default, it calls gtk_show_uri_on_window()
+ * displays these as clickable links. By default, it calls gtk_show_uri()
  * when a user clicks one. The behaviour can be overridden with the
  * #GtkAboutDialog::activate-link signal.
  *
@@ -345,7 +345,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
    *
    * The signal which gets emitted to activate a URI.
    * Applications may connect to it to override the default behaviour,
-   * which is to call gtk_show_uri_on_window().
+   * which is to call gtk_show_uri().
    *
    * Returns: %TRUE if the link has been activated
    */
@@ -979,30 +979,7 @@ static gboolean
 gtk_about_dialog_activate_link (GtkAboutDialog *about,
                                 const gchar    *uri)
 {
-  GError *error = NULL;
-
-  if (!gtk_show_uri_on_window (GTK_WINDOW (about), uri, GDK_CURRENT_TIME, &error))
-    {
-      GtkWidget *dialog;
-
-      dialog = gtk_message_dialog_new (GTK_WINDOW (about),
-                                       GTK_DIALOG_DESTROY_WITH_PARENT |
-                                       GTK_DIALOG_MODAL,
-                                       GTK_MESSAGE_ERROR,
-                                       GTK_BUTTONS_CLOSE,
-                                       "%s", _("Could not show link"));
-      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                                "%s", error->message);
-      g_error_free (error);
-
-      g_signal_connect (dialog, "response",
-                        G_CALLBACK (gtk_widget_destroy), NULL);
-
-      G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-      gtk_window_present (GTK_WINDOW (dialog));
-      G_GNUC_END_IGNORE_DEPRECATIONS
-    }
-
+  gtk_show_uri (GTK_WINDOW (about), uri, GDK_CURRENT_TIME);
   return TRUE;
 }
 
index c7f6b34c319bf36eff768375170923de54d8c1b1..05e9cbe75e056405bc41dcf8dddb1917a54bc96a 100644 (file)
@@ -1502,7 +1502,7 @@ open_folder_cb (GSimpleAction *action,
       gchar *uri;
 
       uri = g_file_get_uri (file);
-      gtk_show_uri_on_window (GTK_WINDOW (toplevel), uri, GDK_CURRENT_TIME, NULL);
+      gtk_show_uri (GTK_WINDOW (toplevel), uri, GDK_CURRENT_TIME);
       g_free (uri);
     }
 
index 6f6efaec6440db05901efa6b9ec4a514c14bd8be..992bc9cc697b3666b41ad6fc4b55f78a4d1a2f93 100644 (file)
@@ -740,7 +740,7 @@ gtk_label_class_init (GtkLabelClass *class)
      *
      * The signal which gets emitted to activate a URI.
      * Applications may connect to it to override the default behaviour,
-     * which is to call gtk_show_uri_on_window().
+     * which is to call gtk_show_uri().
      *
      * Returns: %TRUE if the link has been activated
      */
@@ -5816,16 +5816,11 @@ gtk_label_activate_link (GtkLabel    *label,
 {
   GtkWidget *widget = GTK_WIDGET (label);
   GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
-  GError *error = NULL;
 
   if (!GTK_IS_WINDOW (toplevel))
     return FALSE;
 
-  if (!gtk_show_uri_on_window (GTK_WINDOW (toplevel), uri, GDK_CURRENT_TIME, &error))
-    {
-      g_warning ("Unable to show '%s': %s", uri, error->message);
-      g_error_free (error);
-    }
+  gtk_show_uri (GTK_WINDOW (toplevel), uri, GDK_CURRENT_TIME);
 
   return TRUE;
 }
index b99ae2a0d451dd8704b365d2d9ada0382bde41e4..ee82086798e52c19443d263e3fb407258595e1e4 100644 (file)
@@ -38,7 +38,7 @@
  * The URI bound to a GtkLinkButton can be set specifically using
  * gtk_link_button_set_uri(), and retrieved using gtk_link_button_get_uri().
  *
- * By default, GtkLinkButton calls gtk_show_uri_on_window() when the button is
+ * By default, GtkLinkButton calls gtk_show_uri() when the button is
  * clicked. This behaviour can be overridden by connecting to the
  * #GtkLinkButton::activate-link signal and returning %TRUE from the
  * signal handler.
@@ -209,7 +209,7 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass)
    * The ::activate-link signal is emitted each time the #GtkLinkButton
    * has been clicked.
    *
-   * The default handler will call gtk_show_uri_on_window() with the URI stored inside
+   * The default handler will call gtk_show_uri() with the URI stored inside
    * the #GtkLinkButton:uri property.
    *
    * To override the default behavior, you can connect to the ::activate-link
@@ -495,22 +495,10 @@ gtk_link_button_activate_link (GtkLinkButton *link_button)
 {
   GtkLinkButtonPrivate *priv = gtk_link_button_get_instance_private (link_button);
   GtkWidget *toplevel;
-  GError *error;
 
   toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (link_button)));
 
-  error = NULL;
-  gtk_show_uri_on_window (GTK_WINDOW (toplevel), priv->uri, GDK_CURRENT_TIME, &error);
-  if (error)
-    {
-      g_warning ("Unable to show '%s': %s",
-                 priv->uri,
-                 error->message);
-      g_error_free (error);
-
-      return FALSE;
-    }
-
+  gtk_show_uri (GTK_WINDOW (toplevel), priv->uri, GDK_CURRENT_TIME);
   gtk_link_button_set_visited (link_button, TRUE);
 
   return TRUE;
index 93cb8724e2548bd69ae36c07af78faf3c2381a88..eb155a78b672208c3078f9dfde05ca39d3e00344 100644 (file)
@@ -672,6 +672,6 @@ gtk_print_operation_portal_launch_preview (GtkPrintOperation *op,
   char *uri;
 
   uri = g_filename_to_uri (filename, NULL, NULL);
-  gtk_show_uri_on_window (parent, uri, GDK_CURRENT_TIME, NULL);
+  gtk_show_uri (parent, uri, GDK_CURRENT_TIME);
   g_free (uri);
 }
index 16ca75cf1bd4c48f7621a668fea36fb3176d16b4..45584d28bdcbb24be18aeed667ec7aacb9d0262b 100644 (file)
@@ -312,7 +312,7 @@ gtk_print_operation_unix_launch_preview (GtkPrintOperation *op,
       g_error_free (error);
       error = NULL;
       uri = g_filename_to_uri (filename, NULL, NULL);
-      gtk_show_uri_on_window (parent, uri, GDK_CURRENT_TIME, &error);
+      gtk_show_uri (parent, uri, GDK_CURRENT_TIME);
       g_free (uri);
     }